Diashows #Koch3 und #Koch4
-------------------------------------

Diashow Koch3
=============
ScriptBegin
var Grafik = "Script Turtle";
l=5.5;   // Gre 0.5 - 3.5
w=89;    // Winkel 0-360


function koch(n,l)
{ if (n<1) t.move(l, 1)
  else
  { koch(n-1, l); 
    t.turn(w);
    koch(n-1, l);
    t.turn(-2*w);
    koch(n-1, l);
    t.turn(w);  
    koch(n-1, l);
  }  
} 

function stein(l)
{t.beginPolygon();
 t.moveTo(0,0);
 koch(4,l); t.turn(90);
 koch(4,l); t.turn(90); 
 koch(4,l); t.turn(90);
 koch(4,l);
 t.endPolygon();//t.moveTo(0,0);
}

function init()
{ t.setPage(-50,160, 4);
  t.setBrush("cadetblue");
  if (w<=0) w=89;
  dec=15*(w-89)*(w-89)/7921+0.3;
  w=t.showDia(400, 89, dec);
}

function draw()
{ //t.drawKoordSystem();
  //t.drawRaster();
 
 // Seitenlnge bestimmen
 t.setNoStyle();
 koch(4,l); d = t.lastX(); t.moveTo(0,0,2);

 // Stein ins Polygon schreiben
 stein(l,this);  t.turnTo(0);

 t.setPen("black",0);

 for(i=-1; i<4; i++)
 {for(j=-1; j<3; j++)
   {//t.setBrush(t.rndRGB(205,53,30));
    t.setBrush( "lightsalmon");
    t.goTo(i*d,j*d);
    t.drawPolygon();
   } 
 } 
 t.rahmen();
}
ScriptEnd#Koch3
-------------------------------------------


Diashow Koch4, Farben zufllig
==============================
ScriptBegin
var Grafik = "Script Turtle";
l=1.0;   // Gre 0.5 - 3.5
w=15;    // Winkel 0-360


function koch(n,l)
{ if (n<1) t.move(l, 1)
  else
  { koch(n-1, l); 
    t.turn(60);
    koch(n-1, l);
    t.turn(-120);
    koch(n-1, l);
    t.turn(60);  
    koch(n-1, l);
  }  
} 


function koch2(n,l)
{ if (n<1) t.move(l, 1)
  else
  { koch2(n-1, l); 
    t.turn(-60);
    koch2(n-1, l);
    t.turn(+120);
    koch2(n-1, l);
    t.turn(-60);  
    koch2(n-1, l);
  }  
} 


function stein(x,y,l)
{ t.beginPolygon();
  t.goTo(x,y); 
  t.turnTo(0);
  koch(4, l);
  t.turn(60); 
  koch(2,4*l);
  t.turn(120); 
  koch2(4, l);
  t.turn(60); 
  koch2(2,4*l);
  t.endPolygon(); 
}


function drawstein(dx,dy,w)
{ t.setNoStyle()
  t.goTo(0,0);
  t.turnTo(w);    t.move(dx);
  t.turnTo(w+60); t.move(dy);    
  t.setPen();
  t.setBrush();
  t.turnTo(w);
  t.goTo(t.lastX(),t.lastY());
  t.drawPolygon();
}


function init()
{ t.showDia(900, 20);
}

function draw()
{t.drawKoordSystem();
 t.drawRaster();

 t.setNoStyle();
 koch(2,4*l); dy=t.lastX();

 t.moveTo(0,0); koch(4,l); dx=t.lastX();

 stein(0,0,l);  // Stein definieren  
 
 t.setPen("lightgray",0.3);
 //t.setRndRGB("green","lightblue");
 t.setRndRGB("orange","orangered");
 t.setRndHeller(20,70); 

 for(i=-3; i<4; i++)
 {for(j=-6; j<6; j++)
   { t.setBrush(t.rndRGB2());
     drawstein(i*dx,j*dy, w);
   } 
 }
 t.setPen("black",0);
 t.rahmen();
}
ScriptEnd#Koch4
-------------------------------------------
